<template>
  <div>
    <Card title="查看归类" :bordered="false" dis-hover class="ivu-mt">
      <Form
        ref="brandForm"
        :model="infoData"
        :rules="ruleInline"
        :label-width="140"
      >
        <Row>
          <Col span="18" offset="3">
            <FormItem label="归类名称：" prop="classificationName">
              <span>{{ infoData.classificationName }}</span>
            </FormItem>
          </Col>
          <Col span="18" offset="3">
            <FormItem label="税类名称：" prop="taxCateName">
              <span>{{ infoData.taxCateName }}</span>
            </FormItem>
          </Col>
          <Col span="18" offset="3">
            <FormItem label="税类编号：">
              <span>{{ infoData.taxCateNo }}</span>
            </FormItem>
          </Col>
          <Col span="18" offset="3">
            <FormItem label="税率：">
              <span>{{ infoData.taxRate }}</span>
            </FormItem>
          </Col>
          <Col span="18" offset="3">
            <FormItem label="介绍：" prop="note">
              <span>{{ infoData.note }}</span>
            </FormItem>
          </Col>
          <!-- <Col span="18" offset="2" >
                        <FormItem label="原因" v-if="infoData.state !='2'">
                            <Input v-model="reason" maxlength="100" show-word-limit
                                type="textarea" placeholder="请输入原因"/>
                        </FormItem>
                    </Col> -->
          <Col span="18" offset="3">
            <FormItem>
              <Button @click="goBack">返回</Button>
              <!-- <template v-if="infoData.state !='2'" >
                            <Button class="ivu-ml-8" :loading="isLoading1" @click="auditSubmit('noPass')">审核不通过</Button>
                            <Button type="primary" class="ivu-ml-8" :loading="isLoading" @click="auditSubmit('pass')">审核通过</Button>
                        </template> -->
            </FormItem>
          </Col>
        </Row>
      </Form>
    </Card>
  </div>
</template>
<script>
import brandUpdata from './configjs/classficationAuditAdd';
import Upload from '@/components/common/upload'; // 上传组件

import { ApiRequest } from '@api/basePage';

export default {
  components: {
    Upload
  },
  mixins: [brandUpdata],
  data () {
    return {
      reason: '',
      ruleInline: {
        classificationName: [
          { required: true, message: '请输入归类名称.', trigger: 'blur' }
        ],
        taxCateName: [
          { required: true, message: '请输入税类名称.', trigger: 'blur' }
        ],
        note: [{ required: true, message: '请输入归类介绍.', trigger: 'blur' }]
      },
      infoData: {
        classificationName: '',
        taxCateName: '',
        taxCateNo: '',
        taxRate: '',
        note: '',
        version: '',
        uuid: ''
      },
      taxCateList: [],
      isLoading: false,
      isLoading1: false
    };
  },
  created () {
    this.getConfigData();
    this.getAll();
  },
  methods: {
    // 获取初始配置信息
    getConfigData () {
      this.pagePath = this.$route.path;
      let dynamicData = require('./configjs/classficationAuditAdd').default;
      this.requestApi = dynamicData.requestApi; // 页面所需接口集合
      this.$set(this.$data, 'dynamicData', dynamicData);
      // 重新获取数据
      this.uuid = this.$route.query.uuid;
      this.baseGetByUuid();
    },
    baseGetByUuid () {
      let data = {
        uuid: this.uuid
      };
      ApiRequest(
        this.requestApi.baseGetByUuid.url,
        this.requestApi.baseGetByUuid.type,
        data,
        true
      ).then(res => {
        if (res.retStatus === '1') {
          this.infoData.classificationName = res.retData.classificationName;
          this.infoData.taxCateName = res.retData.taxCateName;
          this.infoData.taxCateNo = res.retData.taxCateNo;
          this.infoData.taxRate = res.retData.taxRate;
          this.infoData.note = res.retData.note;
          this.infoData.version = res.retData.version;
          this.infoData.uuid = this.uuid;
          this.infoData.state = res.retData.state;
        }
      });
    },
    // 获取所有税类名称
    getAll () {
      let data = {};
      ApiRequest(
        this.requestApi.getAllData.url,
        this.requestApi.getAllData.type,
        data,
        false
      ).then(res => {
        if (res.retStatus === '1') {
          this.taxCateList = res.retData;
        }
      });
    },
    // 返回
    goBack () {
      this.$router.go(-1);
    }
  }
};
</script>
